<template>
  <div class="containers">
    <div v-if="list.data" class="introduce artist-info">
      <el-avatar :size="248" :src="list.data.artist.cover" style="margin: 0" />
      <div class="singer">
        <h1 class="name">{{ list.data.artist.name }}</h1>
        <div class="artist">艺人</div>
        <a href="#latest-release" class="songs">{{ list.data.artist.musicSize }}首歌</a>
        ·
        <a href="#seeMore" class="songs">{{ list.data.artist.albumSize }}张专辑</a>
        ·
        <a href="#MVs" class="songs">{{ list.data.artist.mvSize }}个MV</a>
        <div class="introductory" @click="showDialog = true">
          {{ list.data.artist.briefDesc }}
        </div>
        <div>
          <button class="back buttons">
            <i class="iconfont icon-24gf-playCircle bule" />
            播放
          </button>
          <button class="buttons" style="color: #000">关注</button>
          <button class="buttons" style="height: 40px">···</button>
        </div>
      </div>
    </div>
    <!-- 最新发布 -->
    <!-- <div id="latest-release" class="latest-release">
      <div class="section-title">最新发布</div>
      <div class="release">
        <div class="container">
          <div class="cover" style="height:128px; width: 128px">
            <img :src="src" alt="" style="height:128px; width: 128px">
            <i class="iconfont icon-24gf-playCircle" />
          </div>
          <div class="info">
            <div class="name">爱无所谓</div>
            <div class="date">2021年11月19日</div>
            <div class="type">Single · 2 首歌 </div>
          </div>
        </div>
        <div class="container">
          <div class="cover" style="width: 228px; height: 128px">
            <img :src="src" alt="" style="width: 228px; height: 128px">
          </div>
          <div class="info">
            <div class="name">原来...什么都有可能</div>
            <div class="date">2022年01月19日</div>
            <div class="type">最新 MV</div>
          </div>
        </div>
        <div style="display: none" />
      </div>
    </div> -->
    <!-- /最新发布 -->
    <!-- 热门歌曲 -->
    <div class="popular-tracks">
      <div class="section-title">热门歌曲</div>
      <div class="track-list">
        <div class="aaa" style="display: grid; gap: 4px; grid-template-columns: repeat(4, 1fr)">
          <div v-for="(item, index) in hotSong" :key="index" class="track tracklist">
            <img :src="item.al.picUrl" alt="">
            <div class="title-and-artist">
              <div v-if="item.al" class="like">
                <div class="title">{{ item.al.name }}</div>
                <div class="artist">{{ item.ar.name }}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id="seeMore" class="show-more">
        <button>
          <span>显示更多</span>
          <span style="display: none">收起</span>
        </button>
      </div>
    </div>
    <!-- /热门歌曲 -->
    <!-- 专辑 -->
    <div id="albums" class="albums">
      <h1 class="section-title">专辑</h1>
    </div>
    <div>
      <Album />
    </div>
    <!-- /专辑 -->
    <!-- MVs -->
    <div id="MVs" class="MVs">
      <h1 class="section-title">MV</h1>
    </div>
    <div>
      <Video />
    </div>

    <!-- /MVs -->
    <!-- EP 和单曲 -->
    <div id="albums" class="albums">
      <h1 class="section-title">EP 和 单曲</h1>
    </div>
    <div>
      <Single />
    </div>
    <!-- /EP 和单曲 -->
    <el-dialog :visible.sync="showDialog" title="艺术家介绍" style="font-weight:700; font-size:20px">
      <div v-if="list.data">{{ list.data.artist.briefDesc }}</div>
    </el-dialog>
  </div>
</template>

<script>
import Album from './components/album'
import Video from './components/video'
import Single from './components/single'
import { singerParticulars, singerHotSong } from '@/api/singer'
export default {
  name: 'Singer',
  components: {
    Album,
    Video,
    Single
  },
  data() {
    return {
      showDialog: false,
      src: 'https://p2.music.126.net/J_1TOdTMjxviu7OcMolzqA==/109951167039371979.jpg?param=512y512',
      id: this.$route.params.id,
      list: [],
      hotSong: []
    }
  },
  created() {
    this.singerParticulars()
    this.singerHotSong()
    console.log(this.id)
  },
  methods: {
    async singerParticulars() {
      const { data } = await singerParticulars(this.id)
      console.log(data.data)
      this.list = data
    },
    async singerHotSong() {
      const { data } = await singerHotSong(this.id)
      console.log(data)
      this.hotSong = data.songs
    }
  }
}
</script>

<style lang="less">
.artist-info {
  margin-top: 32px;
  height: 253px;
}
.introduce {
  display: flex;
  justify-self: end;
  margin-top: 26px;
}
.singer {
  margin-left: 40px;
}
.name {
  margin-top: 0;
  font-size: 56px;
  font-weight: 700;
}
.artist {
  font-size: 18px;
  opacity: 0.88;
  margin-bottom: 0;
}
.introductory {
  width: 567px;
  height: 35px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  cursor: pointer;
  opacity: .68;
}
.songs {
  text-decoration: none;
  font-size: 12px;
  opacity: 0.68;
  color: black;
}
.songs:hover {
  text-decoration: underline;
  // cursor: pointer;
}
.back {
  color: blue;
  background: #eaeffd;
}
.play {
  font-size: 24px;
}
.buttons {
  border-radius: 8px;
  margin-left:10px;
  height: 40px;
  min-width: 40px;
  font-size: 18px;
  font-weight: 600;
  border: none;
  vertical-align: middle;
  transition: transform .3s;
    &:hover{
      transform: scale(1.1, 1.1);

    }

}
.latest-release {
  height: 223px;
  .section-title {
    font-weight: 600;
    font-size: 22px;
    opacity: .88;
    color: #000;
    margin-bottom: 16px;
    padding-top: 46px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }
  .release {
    display: flex;
    .container {
      display: flex;
      flex: 1;
      align-items: center;
      border-radius: 12px;
      .cover {
        transition: all 0.1s;
        position: relative;
        cursor: pointer;
        overflow: hidden;
         &:hover i{
         display: block;
        }
        i {
        display: none;
        font-size: 40px;
        position: absolute;
        top: 50%;
        left: 50%;
        // backdrop-filter: blur(8px);
        // background: hsla(0, 0%, 100%, 0.14);
        color: rgba(192, 189, 189, 0.836);
        transform: translate(-50%, -50%);
        border-radius: 50%;
        padding: 0;
        }
        img {
          border-radius: 15px;
        }
      }
      .info {
        margin-left: 24px;
        .name {
          font-size: 18px;
          font-weight: 600;
          margin-bottom: 8px;
          color: #000;
          text-decoration: none;
          cursor: pointer;
        }
        .name:hover {
          text-decoration: underline;
        }
        .date {
            font-size: 14px;
            opacity: .78;
          }
        .type {
          margin-top: 2px;
          font-size: 12px;
          opacity: .68;
        }
      }
    }
  }
}
.popular-tracks {
  .section-title {
    font-weight: 600;
    font-size: 22px;
    opacity: .88;
    color: #000;
    margin-bottom: 16px;
    padding-top: 46px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }
  .track {
  display: flex;
  align-items: center;
  border-radius: 12px;
  width: 214px;
  height: 54px;
  padding: 8px;
  img {
    border-radius: 8px;
    height: 38px;
    width: 38px;
    margin-right: 14px;
    border: 1px solid rgba(0,0,0,.04);
  }
  .title-and-artist {
    .like {
      .title {
        font-weight: 600;
        color: #000;
        padding-right: 16px;
      }
      .artist {
        font-size: 12px;
        color: inherit;
        text-decoration: none;
        cursor: pointer;
      }
      .artist:hover {
        text-decoration: underline;
        cursor: pointer;
      }
    }
  }
}
.track:hover{
  background-color: #f5f5f7;
}
  .show-more {
    padding: 4px 8px;
    margin-top: 8px;
    border-radius: 6px;
    font-size: 12px;
    opacity: .78;
    color: #7a7a7b;
    font-weight: 600;
    button {
     background: none;
     border: none;
     cursor: pointer;
   }
 }
}
.albums {
  .section-title {
    font-weight: 600;
    font-size: 22px;
    opacity: .88;
    color: #000;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }
}
.MVs {
  // height: 230px;
  .section-title {
    font-weight: 600;
    font-size: 22px;
    opacity: .88;
    color: #000;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }
}
</style>
